#include "package/internal/CpuIntr.xdc.h"

#define GIEBITMASK  0x8     /* GIE bit position in Status Register (SR) */

/*
 *  ======== disableAll ========
 */
CpuIntr_Key CpuIntr_disableAll()
{
    UInt state;

    state = _get_SR_register();
    _disable_interrupts();
    return(state & GIEBITMASK);
}

/*
 *  ======== enableAll ========
 */
Void CpuIntr_enableAll()
{
    _enable_interrupts();
}

/*
 *  ======== restoreAll ========
 */
Void CpuIntr_restoreAll( CpuIntr_Key key )
{
    if (key) {
        _enable_interrupts();
    }
    else {
        _disable_interrupts();
    }
}
